<template>
	<view class="setting">
		
		<view class="st-content">
			
			<view class="ct-item" @click="navTo('personalInfo')">
				<text>个人信息</text>
				<text class="iconfont">&#xe600;</text>
			</view>
			<view class="ct-item" @click="navTo('paymanagement')">
				<text>支付管理</text>	
				<text class="iconfont">&#xe600;</text>
			</view>
			<view class="ct-item" @click="navTo('about')">
				<text>关于我们</text>	
				<text class="iconfont">&#xe600;</text>
			</view>
			<view class="ct-item" @click="navTo('shipAddress')">
				<text>我的收货地址</text>
				<text class="iconfont">&#xe600;</text>
			</view>
			
		</view>
		
		<view class="st-foot">
			<view class="st-button" @click="show('QSPopup1')">
				切换账号
			</view>
			<view class="st-button margin-top" @click="show('QSPopup2')">
				退出
			</view>
		</view>
		
		<!-- 弹窗部分 -->
		<!-- 610 390 -->
		<!-- 切换账号的 -->
		<QSPopup ref="QSPopup1" type="fadeInUp">
			<view class="popup-content qs-popup">
				<view class="st-pp-title">
					确定切换账号？
				</view>
				<view class="st-pp-button">
					<view @click="hide('QSPopup1')">
						<text class="st-button" >取消</text>
					</view>
					
					<view @click="onExit('/pages/public/userLogin','QSPopup1')">
						<text class="st-button st-active">确认</text>
					</view>
					
				</view>
			</view>
		</QSPopup>
		<!-- 退出登录的 -->
		<QSPopup ref="QSPopup2" type="fadeInUp">
			<view class="popup-content qs-popup">
				<view class="st-pp-title">
					确定退出登录？
				</view>
				<view class="st-pp-button">
					<view  @click="hide('QSPopup2')">
						<text class="st-button">取消</text>
					</view>
					<view @click="onExit('/pages/public/userLogin','QSPopup2')">
						<text class="st-button st-active">确认</text>
					</view>
					
				</view>
			</view>
		</QSPopup>
	</view>
</template>

<script>
	import {mapState,mapMutations} from 'vuex';
	import QSPopup from '@/components/QS-popup/QS-popup.vue';
	export default {
		components:{QSPopup},
		data() {
			return {
				
			};
		},
		computed: {
			...mapState(['isLogin'])
		},
		methods: {
			...mapMutations(['changeLogin']),
			navTo(url) {
				uni.navigateTo({
					url
				});
			},
			onExit(url,ref) {
				this.hide(ref);
				uni.navigateTo({
					url
				});
				uni.removeStorageSync('lph-token');
				uni.removeStorageSync('lph-user-info');
				this.changeLogin(false);
			},
			show(ref){
				this.$refs[ref].show();
			},
			hide(ref){
				this.$refs[ref].hide();
			}
		},
	}
</script>

<style lang="scss" scoped>
@import "static/css/set.scss";
</style>
